home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / f90 / cshift.z / cshift
Encoding:
Text File  |  2002-10-03  |  4.6 KB  |  111 lines

  1. CSHIFT(3I)                                            Last changed: 4-13-99
  2.  
  3.  
  4. NNAAMMEE
  5.      CCSSHHIIFFTT - Performs a circular shift on an array expression
  6.  
  7. SSYYNNOOPPSSIISS
  8.      CCSSHHIIFFTT (([AARRRRAAYY==]_a_r_r_a_y,, [SSHHIIFFTT==]_s_h_i_f_t [,, [DDIIMM==]_d_i_m]))
  9.  
  10. IIMMPPLLEEMMEENNTTAATTIIOONN
  11.      UNICOS, UNICOS/mk, and IRIX systems
  12.  
  13.      CF90, MIPSpro 7 Fortran 90
  14.  
  15. SSTTAANNDDAARRDDSS
  16.      Fortran
  17.  
  18. DDEESSCCRRIIPPTTIIOONN
  19.      The CCSSHHIIFFTT intrinsic function performs a circular shift on an array
  20.      expression of rank 1 or performs circular shifts on all the complete
  21.      rank 1 sections along a given array expression of rank 2 or greater.
  22.      Elements shifted out at one end are shifted in at the other end.
  23.      Different sections can be shifted by different amounts and in
  24.      different directions; positive for left shifts, negative for right
  25.      shifts.
  26.  
  27.      CCSSHHIIFFTT accepts the following arguments:
  28.  
  29.      _a_r_r_a_y     Can be of any type.  It must not be a scalar.
  30.  
  31.      _s_h_i_f_t     Must be integer.  If _a_r_r_a_y has rank 1, _s_h_i_f_t must be a
  32.                scalar.  Otherwise, _s_h_i_f_t must be scalar or have rank _n-1
  33.                and have
  34.                shape (_d , _d , ..., _d     , _d     , ..., _d ),
  35.                        1   2        _d_i_m-1   _d_i_m+1        _n
  36.                where (_d , _d , ..., _d )
  37.                        1   2        _n
  38.                is the shape of _a_r_r_a_y.
  39.  
  40.      _d_i_m       Must be a scalar.  It is an integer with a value in the
  41.                range 1 <= _d_i_m <= _n, where _n is the rank of _a_r_r_a_y.  If _d_i_m
  42.                is omitted, a value of 1 is assumed.
  43.  
  44.      CCSSHHIIFFTT is a transformational function.  The name of this intrinsic
  45.      cannot be passed as an argument.
  46.  
  47. RREETTUURRNN VVAALLUUEESS
  48.      The result is an array of the same type, type parameters, and shape as
  49.      _a_r_r_a_y.
  50.  
  51.      If _a_r_r_a_y has rank 1, element _i of the result is
  52.      _a_r_r_a_y(1 + _m_o_d_u_l_o(_i + _s_h_i_f_t - 1, _s_i_z_e(_a_r_r_a_y))).
  53.  
  54.      If _a_r_r_a_y has rank greater than 1,
  55.      section (_s , _s , ..., _s     , : , _s     , ..., _s )
  56.                1   2        _d_i_m-1       _d_i_m+1        _n
  57.      of the result has a value equal to
  58.      CCSSHHIIFFTT(_a_r_r_a_y (_s , _s , ..., _s     , : , _s     , ..., _s ), _s_h, 1),
  59.                     1   2        _d_i_m-1       _d_i_m+1        _n
  60.      where _s_h is _s_h_i_f_t or
  61.      _s_h_i_f_t(_s , _s , ..., _s     , _s     , ..., _s )
  62.             1   2        _d_i_m-1   _d_i_m+1        _n
  63.  
  64. EEXXAAMMPPLLEESS
  65.      Example 1:  If VV is a rank 1 array [[11,, 22,, 33,, 44,, 55,, 66]], the effect of
  66.      shifting VV circularly to the left by two positions is achieved by
  67.      CCSSHHIIFFTT (( VV,, SSHHIIFFTT == 22)), which has the value [[33,, 44,, 55,, 66,, 11,, 22]].
  68.      Specifying CCSSHHIIFFTT (( VV,, SSHHIIFFTT == --22 )) achieves a circular shift to the
  69.      right by two positions and has the value [[55,, 66,, 11,, 22,, 33,, 44]].
  70.  
  71.      Example 2:  The rows of an array of rank 2 can all be shifted by the
  72.      same amount or by different amounts.  Assume MM is the following array:
  73.  
  74.           | 1 2 3 |
  75.           | 4 5 6 |
  76.           | 7 8 9 |
  77.  
  78.      The value of CCSSHHIIFFTT((MM,, SSHHIIFFTT ==--11,, DDIIMM == 22)) is as follows:
  79.  
  80.           | 3 1 2 |
  81.           | 6 4 5 |
  82.           | 9 7 8 |
  83.  
  84.      The value of CCSSHHIIFFTT((MM,, SSHHIIFFTT ==((// --11,, 11,, 00 //)),, DDIIMM == 22)) is as follows:
  85.  
  86.           | 3 1 2 |
  87.           | 5 6 4 |
  88.           | 7 8 9 |
  89.  
  90.      Example 3:  NN is the following array:
  91.  
  92.           | 1  2  3  4 |
  93.           | 5  6  7  8 |
  94.           | 9 10 11 12 |
  95.  
  96.      The value of CCSSHHIIFFTT((NN,, SSHHIIFFTT ==--11,, DDIIMM == 11)) is as follows:
  97.  
  98.           | 9 10 11 12 |
  99.           | 1  2  3  4 |
  100.           | 5  6  7  8 |
  101.  
  102.      With an array section of multidimensional array NN, the value of
  103.      SSHHIIFFTT((NN((22::33,,22::44)),, SSHHIIFFTT==--11,, DDIIMM==11)) is as follows:
  104.  
  105.           | 10 11 12 |
  106.           |  6  7  8 |
  107.  
  108. SSEEEE AALLSSOO
  109.      _I_n_t_r_i_n_s_i_c _P_r_o_c_e_d_u_r_e_s _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l for the printed version of this
  110.      man page.
  111.